#ifndef __RZ_RANDOM
#define __RZ_RANDOM

unsigned long int __rnd_SEED = 2009;
unsigned long int __rnd_a = 16807;		// 7**5
unsigned long int __rnd_m = 2147483647;		// 2**31-1
double __rnd_im = 4.6566128752457969e-10;	// 1./(2**31-1)

inline int init_prand(unsigned long int seed) {
    __rnd_SEED = seed;
}

double prand() {
    __rnd_SEED = (__rnd_a * __rnd_SEED) % __rnd_m;
    return __rnd_SEED * __rnd_im;
}
#endif
